/**********************************************************************
TreeNode class

This class implements a node for a binary tree class.

Original code found in "Data Abstraction & Problem Soving with Java"
2005., Carrano, F., Prichard, J.
*********************************************************************/

public class TreeNode<T>
{
	private T item;
	private TreeNode<T> leftChild;
	private TreeNode<T> rightChild;

	//*************************************************************
	public TreeNode(T newItem)
	{
		item = newItem;
		leftChild = null;
		rightChild = null;
	}

	//*************************************************************
	public TreeNode(T newItem,TreeNode<T> newLeft,TreeNode<T> newRight)
	{
		item = newItem;
		leftChild = newLeft;
		rightChild = newRight;
	}

	//*************************************************************
	public T getItem()
	{
		return item;
	}

	//*************************************************************
	public void setItem(T newItem)
	{
		item = newItem;
	}

	//*************************************************************
	public TreeNode<T> getLeft()
	{
		return leftChild;
	}

	//*************************************************************
	public TreeNode<T> getRight()
	{
		return rightChild;
	}

	//*************************************************************
	public void setLeft(TreeNode<T> left)
	{
		leftChild = left;
	}

	//*************************************************************
	public void setRight(TreeNode<T> right)
	{
		rightChild = right;
	}
}